<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <title>Paster-by</title>

	<link rel="stylesheet" href="style.css" type="text/css" media="screen" /> 

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>

    <body>

    <div id="wrapper">

    <div id="header">

    	<h1 class="vt-p">Pastebin</h1> 

	<div id="musicplayer" style="position:fixed;top:0px;right:20%"></div> 

    </div>

    <div id="page" class="corners" align="center">

        <?php

            require ( "database.php" );

            if ( $_POST ['input_text'] == NULL ) die ( "Input text is not set!" );

            if ( !isset ( $_POST ['input_language'] ) ) die ( "Input language is not set!" );
			
			if ( $_POST ['input_title'] == NULL )
				$title='Untitled';
			else
				$title = $_POST ['input_title'];
	
	   if ( $_POST ['input_public'] == NULL )
		   $public = 0;
	   else
		   $public = 1;

            $text = $_POST ['input_text'];
			
            database_connect ();

            $id = database_entries ();

	    require("function.php");

	    $link=randStr(8);

            database_insert ( $id, $_POST['input_language'], $text, $title, $public, $link);

            print ( "<h2>Entry added.</h2><br>" );

            $url  = "http://" . $_SERVER['HTTP_HOST'] . dirname ( $_SERVER['PHP_SELF'] );

            $url .= "/" . $link;

            print ( "<h3>Link:&nbsp;&nbsp;<a href=\"" . $url . "\">" . $url . "</h3></a>" );

        ?>

	</div>

	</div>

    </body>

</html>

